<?php

$data = json_decode(file_get_contents("php://input"),true);
// $recu='test serveur ok Reception ';
// foreach ($data as $key => $value){
// $recu=$recu.' cle-> '.$key.' valeur :'.$value;
// }
// $recu=$recu.' transfert ';
$recu = "";
$host="localhost";
$username="ppe4";
$password="ppe4";
$db_name="neochevbook-dev";
$con=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name") or die ("cannot select DB");
$sql = "SELECT * FROM utilisateurs";
$result = mysql_query($sql);
$json = array();
if(mysql_num_rows($result)){
	while($row=mysql_fetch_row($result)){
		$json[]=utf8_encode($row);
	}
}
mysql_close($con);
$recu=$recu.json_encode($json);
echo $recu;
?>
